package com.dys.config;

import com.mybatisflex.core.FlexGlobalConfig;
import com.mybatisflex.core.mybatis.FlexConfiguration;
import com.mybatisflex.spring.boot.ConfigurationCustomizer;
import com.mybatisflex.spring.boot.MyBatisFlexCustomizer;
import com.mybatisflex.spring.boot.SqlSessionFactoryBeanCustomizer;
import org.apache.ibatis.logging.stdout.StdOutImpl;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: 疾风
 * @ClassName: MyBatisFlexConfig
 * @Description: mybatis flex 配置类
 * @CreateDate: 2025/01/13
 * @Version: v1.0.0
 */
@Configuration
public class MyBatisFlexConfig implements ConfigurationCustomizer,
        SqlSessionFactoryBeanCustomizer, MyBatisFlexCustomizer {
    @Override
    public void customize(FlexConfiguration flexConfiguration) {
        System.out.println("mybatis flex FlexConfiguration配置");
        // 配置日志打印输出
        flexConfiguration.setLogImpl(StdOutImpl.class);
    }

    @Override
    public void customize(SqlSessionFactoryBean sqlSessionFactoryBean) {
        System.out.println("mybatis flex SqlSessionFactoryBean配置");
    }

    @Override
    public void customize(FlexGlobalConfig flexGlobalConfig) {
        System.out.println("mybatis flex FlexGlobalConfig配置");
    }
}
